import request from '@/utils/request'
import type { PageDto, PageReqDto, PagesDto } from '../types'
import type { AddInsureCompanyRuleReqDto, EditInsureCompanyRuleReqDto, InsureCompanyRuleDetailDto, InsureCompanyRuleDto } from './types'


/**
 * 获取保司规则列表
 * @param params 
 * @returns 
 */
export function getInsureCompanyRuleList(params: PageReqDto): Promise<PageDto<InsureCompanyRuleDto>> {
    return request.get('/crm-prod-v2/web/pc/crm/insureCompanyRule/list', {
        params
    })
}

/**
 * 新增保司规则
 * @param data 
 * @returns 
 */
export function addInsureCompanyRule(data: AddInsureCompanyRuleReqDto): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyRule/add', data)
}

/**
 * 修改保司规则
 * @param data 
 * @returns 
 */
export function editInsureCompanyRule(data: EditInsureCompanyRuleReqDto): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyRule/edit', data)
}

/**
 * 删除保司规则
 * @param data 
 * @returns 
 */
export function removeInsureCompanyRule(data: {
    id: number
}): Promise<void> {
    return request.post('/crm-prod-v2/web/pc/crm/insureCompanyRule/remove', data)
}

/**
 * 获取保司规则详情
 * @param params 
 * @returns 
 */
export function getInsureCompanyRuleDetail(params: {
    id: number
}): Promise<InsureCompanyRuleDetailDto> {
    return request.get('/crm-prod-v2/web/pc/crm/insureCompanyRule/detail', {
        params
    })
}
